package config;

import config.infra.AbstractSessionFactory;
import config.infra.EnvironmentCreator;
import org.apache.ibatis.session.Configuration;
import org.apache.ibatis.session.SqlSessionFactory;

/**
 * Created by yuanj on 2018/4/18.
 */
public class SessionFactoryCreator extends AbstractSessionFactory {

  private static final SessionFactoryCreator creator=new SessionFactoryCreator();

  public static SqlSessionFactory getFactoryInstance() {
    return creator.getSqlSessionFactory(new Configuration(EnvironmentCreator.createEnvironment()));
  }

  public static SqlSessionFactory getFactoryInstance(String resource) {
    return creator.getSqlSessionFactory(resource);
  }
}
